﻿using System;
using System.IO;
using System.Data;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data.OleDb;
using System.Text.RegularExpressions;
using System.Drawing.Text;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.SystemUI;
using PlanningGIS.Framework;
using PlanningGIS.Win.Controls;
using PlanningGIS.Engine.Controls;

namespace PlanningGIS.Draw
{
    /// <summary>
    /// 
    /// </summary>
    public partial class DropDownAddGeometry : CtlDrawElements, ICommand
    {
         /// <summary>
        /// 构造函数
        /// </summary>
        public DropDownAddGeometry()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="container">控件容器</param>
        public DropDownAddGeometry(IContainer container)
        {
            container.Add(this);
            InitializeComponent();            
        }

        /// <summary>
        /// 
        /// </summary>
        private IApplication m_Application = null;

        /// <summary>
        /// 
        /// </summary>
        protected override void SelectedChanged()
        {
            base.SelectedChanged();
            CurrentCommand.OnCreate((m_Application as IFramework).Object);
            //(this.m_Application as IFramework).ExecuteCommand(CurrentCommand);
            (this.m_Application as IFramework).Tool = CurrentCommand as ITool;
            
        }


        #region ICommand Members
        /// <summary>
        /// 
        /// </summary>
        int ICommand.Bitmap
        {
            get { return 0; }
        }
        /// <summary>
        /// 
        /// </summary>
        string ICommand.Caption
        {
            get { return "DropDownAddGeometry"; }
        }
        /// <summary>
        /// 
        /// </summary>
        string ICommand.Category
        {
            get { return "绘制图形"; }
        }
        /// <summary>
        /// 
        /// </summary>
        bool ICommand.Checked
        {
            get { return false; }
        }
        /// <summary>
        /// 
        /// </summary>
        bool ICommand.Enabled
        {
            get
            {
                if (m_Application == null)
                    return false;
                return (m_Application as IFramework).IsSceneCtlActive == false;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        int ICommand.HelpContextID
        {
            get { return 0; }
        }
        /// <summary>
        /// 
        /// </summary>
        string ICommand.HelpFile
        {
            get { return string.Empty; }
        }
        /// <summary>
        /// 
        /// </summary>
        string ICommand.Message
        {
            get { return "DropDownAddGeometry"; }
        }
        /// <summary>
        /// 
        /// </summary>
        string ICommand.Name
        {
            get { return "DropDownAddGeometry"; }
        }
        /// <summary>
        /// 
        /// </summary>
        void ICommand.OnClick()
        {

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hook"></param>
        void ICommand.OnCreate(object hook)
        {
            if (m_Application == null)
            {
                m_Application = hook as IApplication;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        string ICommand.Tooltip
        {
            get
            {
                return "绘制图形";
            }
        }
        #endregion
    }
}
